<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/',['as'=>'Home','uses'=>'HomeController@index']);

Route::group(['prefix' => 'home'],function(){
    Route::get('login',['as'=>'Home.Auth.login','uses'=>'HomeController@login']);
    Route::get('register',['as'=>'Home.Auth.register','uses'=>'HomeController@register']);
    Route::get('forgetPassword',['as'=>'Home.Auth.forgetPassword','uses'=>'HomeController@forgetPassword']);

    Route::get('about',['as'=>'Home.Auth.about','uses'=>'HomeController@about']);
    Route::get('agree-ment',['as'=>'Home.Auth.agreeMent','uses'=>'HomeController@agreeMent']);
    Route::get('create-facilitator',['as'=>'Home.Service.createFacilitator','uses'=>'HomeController@createFacilitator']);
    Route::get('create-pop',['as'=>'Home.Service.createPop','uses'=>'HomeController@createPop']);
    Route::get('user-center',['as'=>'Home.Service.userCenter','uses'=>'HomeController@userCenter']);
    Route::get('sign-out',['as'=>'Home.Service.signOut','uses'=>'HomeController@signOut']);
});

Route::group(['prefix' => 'admin'],function() {
    Route::get('login',['as'=>'Admin.Auth.login','uses'=>'AdminController@login']);
    Route::get('index',['as'=>'Admin.Index.index','uses'=>'AdminController@index']);
    Route::get('sign-out',['as'=>'Admin.Service.signOut','uses'=>'AdminController@signOut']);
    Route::get('facListPage',['as'=>'Admin.Service.facListPage','uses'=>'AdminController@facListPage']);
    Route::get('inviteListPage',['as'=>'Admin.Service.inviteListPage','uses'=>'AdminController@inviteListPage']);
    Route::get('orgListPage',['as'=>'Admin.Service.orgListPage','uses'=>'AdminController@orgListPage']);
    Route::get('examListPage',['as'=>'Admin.Service.examListPage','uses'=>'AdminController@examListPage']);
    Route::get('mangerListPage',['as'=>'Admin.Service.mangerListPage','uses'=>'AdminController@managerListPage']);
    Route::get('showMessagePage',['as'=>'Admin.Service.showMessagePage','uses'=>'AdminController@showMessagePage']);
    Route::get('showSysInfoPage',['as'=>'Admin.Service.showSysInfoPage','uses'=>'AdminController@showSysInfoPage']);
    Route::get('showChangePwd/{id}',['as'=>'Admin.Service.showChangePwd','uses'=>'AdminController@showChangePwd']);
    Route::get('checkFac/{id}',['as'=>'Admin.Service.checkFac','uses'=>'AdminController@checkFac']);
    Route::get('checkInvite/{id}',['as'=>'Admin.Service.checkInvite','uses'=>'AdminController@checkInvite']);
    Route::get('checkOrg/{id}',['as'=>'Admin.Service.checkOrg','uses'=>'AdminController@checkOrg']);
    Route::get('checkExam/{id}',['as'=>'Admin.Service.checkExam','uses'=>'AdminController@checkExam']);
});

Route::group(['prefix' => 'api'],function() {
    /** ��ȡtoken */
    Route::get('get-csrf-token', ['as' => 'Api.General.GetCsrfToken', 'uses' => 'Api\GeneralController@getCsrfToken']);
    Route::post('auth/get-verify-code-by-phone', ['as' => 'Api.Auth.getVerifyCodeByPhone', 'uses' => 'Api\AuthController@getVerifyCodeByPhone']);
    Route::post('auth/sign-up', ['as' => 'Api.Auth.SignUp', 'uses' => 'Api\AuthController@SignUp']);
    Route::post('auth/sign-in', ['as' => 'Api.Auth.SignIn', 'uses' => 'Api\AuthController@SignIn']);
    Route::post('auth/sign-out', ['as' => 'Api.Auth.SignOut', 'uses' => 'Api\AuthController@SignOut']);
    Route::post('auth/reset-password',['as'=>'Api.Auth.ResetPassword','uses'=>'Api\AuthController@ResetPasswordByPhone']);

    /** 图片上传和显示接口 */
    Route::post('upload/image',['as'=>'Api.Upload.Image','uses'=>'Api\ImageController@UploadImage']);
    Route::get('image/get-image/{id}',['as'=>'Api.GetImage.Image','uses'=>'Api\ImageController@getImageUrlById']);
    Route::get('photo/show/{id}',['as'=>'Api.Photo.Show','uses'=>'Api\FacController@getPhotoByUserId']);
    Route::get('cardf/show/{id}',['as'=>'Api.Cardf.Show','uses'=>'Api\FacController@getCardFByUserId']);
    Route::get('cardb/show/{id}',['as'=>'Api.Cardb.Show','uses'=>'Api\FacController@getCardBByUserId']);
    Route::get('orgphoto/show/{id}',['as'=>'Api.OrgPhoto.Show','uses'=>'Api\OrgController@getLogoByUserId']);
    Route::get('examimg/show/{id}',['as'=>'Api.ExamImg.Show','uses'=>'Api\ExampleController@getExamImgByUserId']);

    Route::post('fac/set-userinfo',['as'=>'Api.Fac.setUserInfo','uses'=>'Api\FacController@setFacInfo']);
    Route::post('fac/get-userinfo',['as'=>'Api.Fac.getUserInfo','uses'=>'Api\FacController@getFacInfo']);
    Route::post('org/set-orginfo',['as'=>'Api.Org.setOrgInfo','uses'=>'Api\OrgController@setOrgInfo']);

    Route::post('exam/set-examinfo/{id}',['as'=>'Api.Exam.setExampleInfo','uses'=>'Api\ExampleController@setExampleInfo']);
    Route::post('exam/del-examinfo',['as'=>'Api.Exam.delExampleInfo','uses'=>'Api\ExampleController@delExampleById']);
    Route::post('exam/get-examinfo',['as'=>'Api.Exam.getExampleInfo','uses'=>'Api\ExampleController@getExampleInfo']);
    Route::post('admin/setFacPass',['as'=>'Api.Admin.setFacPass','uses'=>'Api\AdminController@setFacPass']);
    Route::post('admin/setInvitePass',['as'=>'Api.Admin.setInvitePass','uses'=>'Api\AdminController@setInvitePass']);
    Route::post('admin/setOrgPass',['as'=>'Api.Admin.setOrgPass','uses'=>'Api\AdminController@setOrgPass']);
    Route::post('admin/setExamPass',['as'=>'Api.Admin.setExamPass','uses'=>'Api\AdminController@setExamPass']);
    Route::post('admin/delFac',['as'=>'Api.Admin.delFac','uses'=>'Api\AdminController@delFac']);
    Route::post('admin/delInvite',['as'=>'Api.Admin.delInvite','uses'=>'Api\AdminController@delInvite']);
    Route::post('admin/delOrg',['as'=>'Api.Admin.delOrg','uses'=>'Api\AdminController@delOrg']);
    Route::post('admin/delExam',['as'=>'Api.Admin.delExam','uses'=>'Api\AdminController@delExam']);
    Route::post('admin/facNoPass',['as'=>'Api.Admin.facNoPass','uses'=>'Api\AdminController@facNoPass']);
    Route::post('admin/inviteNoPass',['as'=>'Api.Admin.inviteNoPass','uses'=>'Api\AdminController@inviteNoPass']);
    Route::post('admin/orgNoPass',['as'=>'Api.Admin.orgNoPass','uses'=>'Api\AdminController@orgNoPass']);
    Route::post('admin/examNoPass',['as'=>'Api.Admin.examNoPass','uses'=>'Api\AdminController@examNoPass']);
    Route::post('admin/changePwd',['as'=>'Api.Admin.changePwd','uses'=>'Api\AdminController@changePwd']);
    Route::post('admin/setSysInfo',['as'=>'Api.Admin.setSysInfo','uses'=>'Api\AdminController@setSysInfo']);
});
Route::any('test',function(\Illuminate\Contracts\Auth\Guard $guard){
    $user = $guard->user();
    /** @var Facilitator $facInfo */
    $facInfo = $user->facilitator;
    $as = $facInfo->followChild()->get();

    echo '<pre>';
    foreach($as as $a){
        $a['B']=\App\Pusers::wherePid($a->id)->get();
//        var_dump($a);
    }

    var_dump($as);
    echo '</pre>';
});